import pandas as pd

# 创建数据
data = {
    'TV': [230.1, 44.5, 17.2, 151.5, 180.8],
    'radio': [37.8, 39.3, 45.9, 41.3, 10.8],
    'newspaper': [69.2, 45.1, 69.3, 58.5, 58.4],
    'sales': [22.1, 10.4, 9.3, 18.5, 12.9]
}

# 将数据转换为DataFrame
df = pd.DataFrame(data)

# 指定文件路径
file_path = "D:/Data/Advertising.csv"

# 将DataFrame写入CSV文件
df.to_csv(file_path, index=False)

print(f"文件已保存到 {file_path}")